﻿//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1998-2024 Glodon Company Limited.
//
// Licensed under the MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the “Software”),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once

#include "GbmpModel.h"
#include "IExternalData.h"
#include "DbDataSchema.h"
#include "ILevelHeaderTypeBehavior.h"

namespace gcmp 
{
    class GBMP_MODEL_EXPORT ILevelType : public IExternalData
    {
        DECLARE_CLASS_WITHOUT_DATA_MEMBERS(gcmp, ILevelType, gcmp::IExternalData, 2A90D700 - 01D1 - 40E7 - 9F7C - 5CD2799315D4, gbmpmodel)
    public:
        virtual ~ILevelType() {}

    public:
        /// \brief 创建标高类型
        ///
        /// \param pDoc 文档指针
        /// \param name 标高类型的名字， 名字不能为空
        /// \return 如果成功， 则返回ILevelType的指针， 如果失败， 则为nullptr
        static ILevelType* Create(IDocument* pDoc, const std::wstring& name);


        /// \brief 获取标高类型
        ///
        /// \param pDoc 文档指针
        /// \param name 标高类型的ElementId
        /// \return 如果成功， 则返回ILevelType的指针， 如果失败， 则为nullptr
        static const ILevelType* GetLevelType(IDocument* pDoc, ElementId levelTypeId);

    public:
        /// \brief 标高起始端点是否显示编号
        /// \return true：显示编号， false：不显示编号
        virtual bool IsStartHeaderVisible() const = 0;

        /// \brief 设置标高起始端点是否显示编号
        ///
        /// \param displayHeader 是否显示编号
        virtual void SetIsStartHeaderVisible(bool displayHeader) = 0;

        /// \brief 标高终止端点是否显示编号
        /// \return true：显示编号， false：不显示编号
        virtual bool IsEndHeaderVisible() const = 0;

        /// \brief 设置标高终止端点是否显示编号
        ///
        /// \param displayHeader 是否显示编号
        virtual void SetIsEndHeaderVisible(bool displayHeader) = 0;

        /// \brief 设置标高标头的当前行为
        ///
        /// \param name 标高标头行为的名字
        /// \return 成功， 返回true， 如果标头行为的名字不存在， 返回false
        virtual bool SetCurrentLevelHeaderTypeBehavior(const std::wstring& name) = 0;

        /// \brief 获取标高标头的当前行为
        ///
        /// \return 当前标高标头的行为， 如果没有， 则为nullptr
        virtual const ILevelHeaderTypeBehavior* GetCurrentLevelHeaderTypeBehavior() const = 0;

        /// \brief 根据名字获取标高标头行为
        ///
        /// \return 标高标头行为， 如果没有， 则为nullptr
        virtual const ILevelHeaderTypeBehavior* GetLevelHeaderTypeBehavior(const std::wstring& name) const = 0;

        /// \brief 添加标高标头行为， 如果名字已经存在， 则添加失败
        ///
        /// \param name 标高标头行为
        /// \return 添加成功， 返回true， 失败， 返回false
        virtual bool AddLevelHeaderTypeBehavior(OwnerPtr<ILevelHeaderTypeBehavior> opBehavior) = 0;

        /// \brief 删除标高标头行为， 如果名字不存在， 则删除失败， 如果删除当前标头行为， 则当前的标头行为为默认值
        ///
        /// \param name 标高标头行为的名字
        /// \return 删除成功， 返回true， 失败， 返回false
        virtual bool RemoveLevelHeaderTypeBehavior(const std::wstring& name) = 0;

        /// \brief 获取所有标高标头行为
        ///
        /// \return 所有标高标头行为
        virtual std::vector<const ILevelHeaderTypeBehavior*> GetAllLevelHeaderTypeBehavior() const = 0;
    };

}// namespace gcmp
